package com.rkc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.rkc.model.CouponRecordDO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 冉堃赤
 * @since 2021-10-22
 */
public interface CouponRecordMapper extends BaseMapper<CouponRecordDO> {

    /**
     * 批量更新优惠券使用记录
     * @param id 用户id
     * @param useState 使用状态枚举
     * @param lockCouponRecordIds 优惠券列表
     * @return 影响行数
     */
    int lockUseStateBatch(@Param("userId") long id, @Param("useState") String useState, @Param("lockCouponRecordIds") List<Long> lockCouponRecordIds);

    /**
     * 修改优惠券状态
     * @param couponRecordId
     * @param state
     * @return
     */
    int updateState(@Param("couponRecordId") Long couponRecordId, @Param("useState") String state);

    /**
     * 修改已使用的优惠券状态
     * @param couponRecordId
     * @param state
     * @return
     */
    int updateUsedState(@Param("couponRecordId") Long couponRecordId, @Param("useState") String state);
}
